function FindArticles()
{

if (document.all.SearchMethod.value != "CRMAnswer.BrowseSubject" && document.all.SearchMethod.value != "CRMAnswer.ArticleQueues" && ValidateInput())
{
var s = frmSearchInt.SearchText;

if (s.value == "")
{
alert(LOCID_PLEASE_ENTER_SEARCH);
s.focus();
}
else
{
var oSubjectItems = frmSearchInt.SearchSubject.Items();
var sSubjectId = "";
if (oSubjectItems.length > 0)
{
sSubjectId = oSubjectItems[0].id;
}
crmGrid.SetParameter("stype", "0");
crmGrid.SetParameter("svalue", s.value);
crmGrid.SetParameter("suppressFetch", 0);
crmGrid.SetParameter("ssubject", sSubjectId);
crmGrid.SetParameter("sinflection", frmSearchInt.SearchInflection.value);
crmGrid.SetParameter("queryapi", frmSearchInt.SearchMethod.value);
crmGrid.Refresh();
}
}

return false;
}

function ValidateInput()
{
if (!IsOnline() && document.all.SearchMethod.value == "CRMAnswer.SearchByBody")
{
alert(LOCID_NO_FULL_TEXT_SEARCH_OFFLIN);
return false;
}



if (frmSearchInt.SearchInflection.value == 1)
{
var o = frmSearchInt.SearchText;

if (o.value.indexOf("*") != -1)
{
alert(LOCID_NO_ASTERISK);
o.select();
return false;
}
}

return true;
}


function displaySearchOptions(refreshGrid)
{
var method = document.all.SearchMethod.value;

if (method=="CRMAnswer.BrowseSubject")
{
subjectDiv.style.display = "inline";
searchDiv.style.display = "none";
articleQueueDiv.style.display = "none";
}
else if (method=="CRMAnswer.ArticleQueues")
{
articleQueueDiv.style.display = "inline";
searchDiv.style.display = "none";
subjectDiv.style.display = "none";
}
else
{
subjectDiv.style.display = "none";
articleQueueDiv.style.display = "none";
searchDiv.style.display = "inline";

if (method=="CRMAnswer.RetrieveByNumber")
{
if (!IsNull(searchSubject)) searchSubject.style.display = "none";
if (!IsNull(searchOptions)) searchOptions.style.display = "none";
}
else
{
if (!IsNull(searchSubject)) searchSubject.style.display = "";
if (!IsNull(searchOptions)) searchOptions.style.display = "";
}
}


if (refreshGrid)
{
GridRefresh();
}
}


function answersRetrv(o)
{
if (!IsNull(o))
{
crmGrid.SetParameter("subject", o.Id);
crmGrid.SetParameter("suppressFetch", 0);
crmGrid.SetParameter("queryapi", "CRMAnswer.RetrieveBySubject");
crmGrid.Refresh();
}
}

